#region Using namespaces

using System;

#endregion

namespace BOL.Models
{
    /// <summary>
    /// Provides a pair class
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class Pair<T>
    {
        #region Public properties

        public T First { get; private set; }

        public T Second { get; private set; }

        #endregion

        #region Constructor

        public Pair(T first, T second)
        {
            First = first;
            Second = second;
        }

        #endregion

        #region Public methods

        public T GetTheOtherPair(T obj)
        {
            if (obj.Equals(First))
                return Second;
            if (obj.Equals(Second))
                return First;

            throw new ArgumentException();
        }

        #endregion

        #region Object overriden

        public override string ToString()
        {
            return String.Format("[{0}, {1}]", First, Second);
        }

        #endregion
    }
}
